double findMedianSortedArrays(int* nums1, int nums1Size, int* nums2, int nums2Size){
    int len = nums1Size + nums2Size;
    int arr[len];
    int counter = 0;
    int i = 0, j = 0;
    int flag = 1;
    if(nums1Size == 0) {
        for(; j < nums2Size; j++) {
            arr[j] = nums2[j];
        }
        counter = j;
        flag = 0;
    }
    if(nums2Size == 0) {
        for(; i < nums1Size; i++) {
            arr[i] = nums1[i];
        }
        counter = i;
        flag = 0;
    }
    while(flag) {
        if(i >= nums1Size) {
            for(; j < nums2Size; j++) {
                arr[counter] = nums2[j];
                counter++;
            }
            break;
        }
        if(j >= nums2Size) {
            for(; i < nums1Size; i++) {
                arr[counter] = nums1[i];
                counter++;
            }
            break;
        }
        if(nums1[i] > nums2[j]) {
            arr[counter] = nums2[j];
            counter++;
            j++;
        }
        else {
            arr[counter] = nums1[i];
            counter++;
            i++;
        }
    }

    if(len % 2 == 0) {
        return (arr[len / 2] + arr[len / 2 - 1]) / 2.0;
    }
    else {
        return arr[len / 2];
    }
}